package com.corpgovernment.common.operatelog.enums;

/**
 * @ClassName: SiteEnum
 * @description: TODO
 * @author: jiang.luo
 * @date: Created in 19:08 2020/1/6
 * @Version: 1.0
 **/

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * 产线枚举
 */
public enum SiteEnum {
    flight("flight","机票"),
    train("train","火车票"),
    hotel("hotel","酒店"),
    car("car","用车"),
    flightintl("flightintl","国际机票"),
    hotelintl("hotelintl", "海外酒店"),
    airporttransfer("airportTransfer","接送机"),
    traintransfer("trainTransfer","接送站"),
    other("other", "其他");

    /**
     * 描述
     */
    private String desc;

    /**
     * code
     */
    private String code;


    private SiteEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private static final Map<String, SiteEnum> lookup = new HashMap<>();

    static {
        for (SiteEnum s : EnumSet.allOf(SiteEnum.class)) {
            lookup.put(s.getCode(), s);
        }
    }

    public String getDesc() {
        return desc;
    }

    public String getCode() {
        return code;
    }

    public static SiteEnum get(String code) {
        return lookup.get(code);
    }
    public static boolean exists(String code) {
        return lookup.containsKey(code);
    }
}
